home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdio.h>
-
- struct s_node
- {
- struct s_node *next_node;
- char *string_value;
- };
-
- void main()
- {
- /* Let's just do static initialization for now */
- static struct s_node fourth_node = { NULL, "Four"};
- static struct s_node third_node = {&fourth_node, "Three"};
- static struct s_node second_node = {&third_node, "Second"};
- static struct s_node first_node = {&second_node, "First"};
- static struct s_node *root_node = &first_node;
- static struct s_node *current_node = NULL;
- int counter;
-
- /* Get to the third node */
- current_node = root_node;
- for (counter = 0; counter < 2; counter ++)
- {
- current_node = current_node->next_node;
- }
- printf("Third string value is %s",
- current_node->string_value);
- }
-
-